package com.yookey.study.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by arvin on 2018/8/17.
 */

public abstract class HomeAdapter<T> extends BaseAdapter<T> {

    public static int TYPE_TITLE=10;
    public HomeAdapter(List data, Context context) {
        super(data, context);
    }


    @Override
    public BaseHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        int layoutId=0;
        switch (viewType)
        {
            case sType_Header:
                layoutId=mHeaderId;
                break;
            case sType_bottom:
                layoutId=mBottomId;
                break;
            default:
                break;
        }
        if(layoutId==0)
        {
            layoutId=mLayouts.get(viewType);
        }
        View inflate = mLayoutInflater.inflate(layoutId, null, false);
        if(viewType==sType_normal)
        {
            int size = mContext.getResources().getDisplayMetrics().widthPixels/4;
            ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(size,size);
            inflate.setLayoutParams(layoutParams);
        }
        BaseHolder holder = BaseHolder.getHolder(mContext, inflate);
        return holder;

    }



}
